<?php
defined('_JEXEC') or die;

require_once 'Mobile_Detect.php';
$detect = new Mobile_Detect;
if( $detect->isMobile() )
{
	include('step5_mobile.php');
	return;
}

$sess=JFactory::getSession();
$dat=$sess->get("regs1.data");

if($dat){
	$db=JFactory::getDbo();
	$db->setQuery("SELECT id FROM #__users WHERE email=".$db->quote($dat['email']));
	$id_user=$db->loadResult();
}

if(!$id_user)
	jexit("step5 N/A");

$value=$sess->get('regs3.data');
?>
<style type="text/css">
	.w145{width:145px}
	.w290{width:290px}
	.nohand{cursor:default}
</style>
<!--begin-->
<div class="wrapper">
				<div class="content" id="exerciseHabits-page">
					<div class="col-wrapper clearfix">
						<div class="info">
							<ul class="breadcrumb mb20">
					<li><a class="nohand">Personlige oplysninger</a></li>
					<li><a class="nohand">Dit abonnement</a></li>
					<li><a class="nohand">Book tid hos din vejleder</a></li>
					<li><a class="nohand">Kostvaner/ ønsker</a></li>
					<li class="active"><a>Motionsvaner/ ønsker</a></li>
							</ul>
							 <form id="member-registration" method="post" class="form-validate">
							
								<h1 class="hd">Motionsvaner/ ønsker</h1>
								<div class="colum2 bor mr30 fl">
									<div class="colum2-wra">
										<label>Dine nuværende motionsvaner:</label>
										<div><label class="fl mt10">Dyrker du nogen form for motion</label></div>
										<div class="fl ml60">
											<label class="uper">Ja/Nej</label>
											<input class="ra" type="radio" value="1" name="1" <?php if($value['1']) echo "checked"?>>
											<input class="ra" type="radio" value="" name="1" <?php if(!$value['1']) echo "checked"?> >
										</div>
										<div id="opt1" <?php echo $value['1'] ? '' : 'class="desc"'?>>
											<label class="fl ita w150">Hvis ja, hvilken og hvor meget?</label>
											<div>
												<input  class="w161 ml100" name="meget" id="meget" value="<?php echo $value['meget']?>">
											</div>
										</div>
									</div>
									<div class="colum2-wra">
										<label>Mulige motionsvaner:</label>
										<div class="mt10"><label>Hvilken former for motion/træning kan kan du lide?</label></div>
										<div class="fl w290">
											<div class="fl w145">
												<input class="fl ck2" type="checkbox" name="exercise[0]" <?php if($value['exercise'][0]) echo "checked"?> value="Styrketræning">Styrketræning
											</div>
											<div class="fl w145">
												<input class="fl ck2" type="checkbox" name="exercise[1]" <?php if($value['exercise'][1]) echo "checked"?> value="Aerobic">Aerobic
											</div>
											<div class="fl w145">
												<input class="fl ck2" type="checkbox" name="exercise[2]" <?php if($value['exercise'][2]) echo "checked"?> value="Løb">Løb
											</div>
											<div class="fl w145">
												<input class="fl ck2" type="checkbox" name="exercise[3]" <?php if($value['exercise'][3]) echo "checked"?> value="Cykling">Cykling
											</div>
											<div class="fl w145">
												<input class="fl ck2" type="checkbox" name="exercise[4]" <?php if($value['exercise'][4]) echo "checked"?> value="Gåture">Gåture
											</div>
											<div class="fl w145">
												<input class="fl ck2" type="checkbox" name="exercise[5]" <?php if($value['exercise'][5]) echo "checked"?> value="Holdsport">Holdsport
											</div>
											<div class="fl w145">
												<input class="fl ck2" type="checkbox" name="exercise[6]" <?php if($value['exercise'][6]) echo "checked"?> value="Crossfit">Crossfit
											</div>
											<div class="fl w145">
												<input class="fl ck2" type="checkbox" name="exercise[7]" <?php if($value['exercise'][7]) echo "checked"?> id="other" value="<?php echo $value['exercise'][7]?>">Andet
											</div>
										</div>
										<div class="w210<?php echo $value['exercise'][7] ? '' : ' desc'?>" id="opt2" style="position: absolute;margin-top: 118px;margin-left: 253px;">
											<label>Hvis andet, hvad?</label>
											<div>
												<input class="w161" id="exercise" value="<?php echo $value['exercise'][7]?>">
											</div>
										</div>
									</div>
								</div>

								<div class="colum2 bor fr">
									<div class="w425">
										<label class="fl">Hvor mange timer kan du afsætte til<br> motion/træning om ugen</label>
										<select class="fr w96" name="omugen" id="omugen">
											<option <?php if($value['omugen']=='1') echo "selected"?>>1</option>
											<option <?php if($value['omugen']=='2') echo "selected"?>>2</option>
											<option <?php if($value['omugen']=='3') echo "selected"?>>3</option>
											<option <?php if($value['omugen']=='4') echo "selected"?>>4</option>
											<option <?php if($value['omugen']=='5') echo "selected"?>>5</option>
											<option <?php if($value['omugen']=='6') echo "selected"?>>6</option>
											<option <?php if($value['omugen']=='7') echo "selected"?>>7</option>
											<option <?php if($value['omugen']=='8') echo "selected"?>>8</option>
											
											<option <?php if($value['omugen']=='9') echo "selected"?>>9</option>
											<option <?php if($value['omugen']=='10') echo "selected"?>>10+</option>
										</select>
									</div>
									<div class="clearfix">
										<label class="mb10">Hvilke dage kan du dyrke motion i</label>
										<div class="fl w100">
											<input class="ck3" type="checkbox" name="workoutinweek[0]" <?php if($value['workoutinweek'][0]) echo "checked"?> value="Mandag">Mandag
										</div>
										<div class="fl w100">
											<input class="ck3" type="checkbox" name="workoutinweek[1]" <?php if($value['workoutinweek'][1]) echo "checked"?> value="Tirsdag">Tirsdag
										</div>
										<div class="fl w100">
											<input class="ck3" type="checkbox" name="workoutinweek[2]" <?php if($value['workoutinweek'][2]) echo "checked"?> value="Onsdag">Onsdag
										</div>
										<div class="fl w100">
											<input class="ck3" type="checkbox" name="workoutinweek[3]" <?php if($value['workoutinweek'][3]) echo "checked"?> value="Torsdag">Torsdag
										</div>
										<div class="fl w100">
											<input class="ck3" type="checkbox" name="workoutinweek[4]" <?php if($value['workoutinweek'][4]) echo "checked"?> value="Fredag">Fredag
										</div>
										<div class="fl w100">
											<input class="ck3" type="checkbox" name="workoutinweek[5]" <?php if($value['workoutinweek'][5]) echo "checked"?> value="Lørdag">Lørdag
										</div>
										<div class="fl w100">
											<input class="ck3" type="checkbox" name="workoutinweek[6]" <?php if($value['workoutinweek'][6]) echo "checked"?> value="Søndag">Søndag
										</div>
									</div>
									<div>
										<label>Har du nogle skader der gør at du ikke kan <br> dyrke visse former for motion/træning?</label>
									</div>
									<div style="float: right;" class="fl">
										<label class="uper">Ja/Nej</label>
										<input class="ra" type="radio" value="1" name="3" <?php if($value['3']) echo "checked"?>>
										<input class="ra" type="radio" value="" name="3" <?php if(!$value['3']) echo "checked"?>>
									</div>
									<div class="w425<?php echo $value['hvormeget'] ? '' : ' desc'?>" id="opt3">
										<label class="fl ita">Hvis ja, hvilken og hvor meget?</label>
										<div class="clear"></div>
										<div class="mb0 fr">
											<input class="w161 fr ml78" name="hvormeget" value="<?php echo $value['hvormeget']?>">
										</div>
									</div>
									<div class="w425 mt10" style="margin-bottom: 31px">
										<label class="fl ita">Hvad motiverer dig til at tabe vægt eller<br> forøge muskelmasse?</label>
										<input class="w161 fr" name="motive" value="<?php echo $value['motive']?>">
									</div>
								</div>

								<div class="clear"></div>
								<a class="fl bntPrevious" href="index.php?option=com_users&view=registration&layout=step4">Forrige</a>
								<a class="fr bntNext" href="javascript:void(0)" onclick="jQuery('#member-registration').submit();">Næste</a>
								<input type="hidden" name="option" value="com_users"/>
								<input type="hidden" name="task" value="registration.step3"/>
							</form>
						</div>
					</div>
				</div>
			</div>
<script type="text/javascript">
	$(document).ready(function(){ 
		$("input[name=1]").change(function() {
			$("#opt1").toggleClass("desc");
			if(!$(this).val())
				$("#member-registration")[0].meget.value='';
		});

		$('#member-registration').submit(function() {
			if($("#other").is(":checked")){
				$("#other").val($("#exercise").val());
			}
		})
		$("#other").change(function() {
			$("#opt2").toggleClass("desc");
		});

		$("input[name=3]").change(function() {
			$("#opt3").toggleClass("desc");
			if(!$(this).val())
				$("#member-registration")[0].hvormeget.value='';
		});
	});
</script>